#include "ConditionVariable.h"

ConditionVariable::ConditionVariable() {
	pthread_cond_init(&this->condVariable, NULL);
	this->mutex = new MutexEncapsulation();
}

MutexEncapsulation* ConditionVariable::getMutex() {
	return this->mutex;
}


void ConditionVariable::wait() {
	pthread_cond_wait(&this->condVariable, &this->mutex->mutex);
}

void ConditionVariable::signal() {
	pthread_cond_signal(&this->condVariable);
}


ConditionVariable::~ConditionVariable() {
	delete this->mutex;
	pthread_cond_destroy(&this->condVariable);
}
